package com.blobfish.fiction.common.base.knowledge;

/**
 * 字典码表
 */
public class DataDictKnowledge {
    private DataDictKnowledge() {
    }

    /**
     * 小说状态枚举
     */
    public enum BookStateEnum implements IDataDictEnum {
        UN_DOWNLOAD("1", "未下载"),
        DOWNLOADING("2", "下载中"),
        DOWNLOADED("3", "已下载"),
        CHANGED("4", "有更新");

        private static final String DATA_DICT_CODE = "BOOK_STATE";
        private String dataCode;
        private String dataText;

        BookStateEnum(String dataCode, String dataText) {
            this.dataCode = dataCode;
            this.dataText = dataText;
        }

        /**
         * 返回字典码表分类代码"
         *
         * @return 字典码表分类代码"
         */
        @Override
        public String getDataDictCode() {
            return DATA_DICT_CODE;
        }

        /**
         * 通过代码找到枚举
         *
         * @param code 代码"
         * @return 枚举
         */
        public static BookStateEnum forCode(String code) {
            BookStateEnum item = null;
            BookStateEnum[] allItems = values();
            for (int i = 0; i < allItems.length; i++) {
                if (allItems[i].codeEquals(code)) {
                    item = allItems[i];
                    break;
                }
            }
            return item;
        }

        @Override
        public String getDataCode() {
            return this.dataCode;
        }

        @Override
        public String getDataText() {
            return this.dataText;
        }
    }

    public enum MessageStateEnum implements IDataDictEnum {
        UNREAD("0", "未读"),
        READ("1", "已读");

        private static final String DATA_DICT_CODE = "MESSAGE_STATE";
        private String dataCode;
        private String dataText;

        MessageStateEnum(String dataCode, String dataText) {
            this.dataCode = dataCode;
            this.dataText = dataText;
        }

        /**
         * 返回字典码表分类代码"
         *
         * @return 字典码表分类代码"
         */
        @Override
        public String getDataDictCode() {
            return DATA_DICT_CODE;
        }

        /**
         * 通过代码找到枚举
         *
         * @param code 代码"
         * @return 枚举
         */
        public static MessageStateEnum forCode(String code) {
            MessageStateEnum item = null;
            MessageStateEnum[] allItems = values();
            for (int i = 0; i < allItems.length; i++) {
                if (allItems[i].codeEquals(code)) {
                    item = allItems[i];
                    break;
                }
            }
            return item;
        }

        @Override
        public String getDataCode() {
            return this.dataCode;
        }

        @Override
        public String getDataText() {
            return this.dataText;
        }
    }

    /**
     * 消息类型枚举
     */
    public enum MessageTypeEnum implements IDataDictEnum {
        UNREAD("0", "系统消息"),
        READ("1", "下载消息");

        private static final String DATA_DICT_CODE = "MESSAGE_TYPE";
        private String dataCode;
        private String dataText;

        MessageTypeEnum(String dataCode, String dataText) {
            this.dataCode = dataCode;
            this.dataText = dataText;
        }

        /**
         * 返回字典码表分类代码"
         *
         * @return 字典码表分类代码"
         */
        @Override
        public String getDataDictCode() {
            return DATA_DICT_CODE;
        }

        /**
         * 通过代码找到枚举
         *
         * @param code 代码"
         * @return 枚举
         */
        public static MessageTypeEnum forCode(String code) {
            MessageTypeEnum item = null;
            MessageTypeEnum[] allItems = values();
            for (int i = 0; i < allItems.length; i++) {
                if (allItems[i].codeEquals(code)) {
                    item = allItems[i];
                    break;
                }
            }
            return item;
        }

        @Override
        public String getDataCode() {
            return this.dataCode;
        }

        @Override
        public String getDataText() {
            return this.dataText;
        }
    }

    /**
     * 消息类型枚举
     */
    public enum RequestMethodTypeEnum implements IDataDictEnum {
        GET("GET", "GET请求"),
        POST("POST", "POST请求");

        private static final String DATA_DICT_CODE = "REQUEST_METHOD_TYPE";
        private String dataCode;
        private String dataText;

        RequestMethodTypeEnum(String dataCode, String dataText) {
            this.dataCode = dataCode;
            this.dataText = dataText;
        }

        /**
         * 返回字典码表分类代码"
         *
         * @return 字典码表分类代码"
         */
        @Override
        public String getDataDictCode() {
            return DATA_DICT_CODE;
        }

        /**
         * 通过代码找到枚举
         *
         * @param code 代码"
         * @return 枚举
         */
        public static RequestMethodTypeEnum forCode(String code) {
            RequestMethodTypeEnum item = null;
            RequestMethodTypeEnum[] allItems = values();
            for (int i = 0; i < allItems.length; i++) {
                if (allItems[i].codeEquals(code)) {
                    item = allItems[i];
                    break;
                }
            }
            return item;
        }

        @Override
        public String getDataCode() {
            return this.dataCode;
        }

        @Override
        public String getDataText() {
            return this.dataText;
        }
    }
}
